package com.nianzhen.Base;

import android.support.v7.app.ActionBarActivity;
import android.view.ViewConfiguration;

import java.lang.reflect.Field;

/**
 * Created by Administrator on 2015/7/30.
 */
public class BaseActionBarActivit extends ActionBarActivity {
    /** 将菜单显示在actionbar上，而不是在底部*/
    protected void requestActionBarMenu() {
        try {
            ViewConfiguration config = ViewConfiguration.get(this);
            Field menuKeyField = ViewConfiguration.class
                    .getDeclaredField("sHasPermanentMenuKey");

            if (menuKeyField != null) {
                menuKeyField.setAccessible(true);
                menuKeyField.setBoolean(config, false);
            }
        } catch (Exception e) {
            // presumably, not relevant
        }
    }
}
